﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace devtm.Editor.Configuration.Merge
{


    public enum EnumDiff
    {
        SectionUpdated,
        SectionAdded,
        SectionDeleted
    }


    public abstract class DiffItem
    {

        public static DiffItem Create(ElementSection elementSection, ConfigurationSection section)
        {

            DiffItem i;

            if (elementSection == null)
                i = new DiffItemAdded(elementSection, section);
            
            else if (section == null)
                i = new DiffItemDeleted(elementSection, section);

            else
                i = new DiffItemUpdated(elementSection, section);

            return i;

        }


        protected DiffItem(ElementSection elementSection, ConfigurationSection section)
        {
            Left = new Diff(elementSection, Enumside.Left);
            Right = new Diff(section, Enumside.Right);
        }

        public EnumDiff Type { get; set; }
        public Diff Left { get; set; }
        public Diff Right { get; set; }

    }


}
